<!-- eslint-disable vue/multi-word-component-names -->
<script setup>
import { onMounted, ref } from "vue";
import { getTodayTip } from "@/api/tip";
import { getToken } from "@/utils/auth";

let author = ref();
let content = ref();

let token = ref();
onMounted(async () => {
  token.value = getToken();
  const res = await getTodayTip();
  author.value = res.author;
  content.value = res.author;
});
</script>

<template>
  <el-card class="box-card" shadow="never">
    <slot name="header">
      <span>发帖</span>
    </slot>
    <div>
      <div v-if="token !== null && token !== ''" class="has-text-centered">
        <b-button
          type="is-danger"
          tag="router-link"
          :to="{ path: '/login' }"
          outliend
          >发表想法
        </b-button>
      </div>
      <div v-else class="has-text-centered">
        <b-button
          type="is-primary"
          tag="router-link"
          :to="{ path: '/register' }"
          outliend
          >马上入住</b-button
        >

        <b-button
          type="is-primary"
          tag="router-link"
          :to="{ path: '/login' }"
          outliend
          >登入社区</b-button
        >
      </div>
    </div>
  </el-card>
</template>

<style scoped lang="less"></style>
